package com.imooc.demo.resources;

import lombok.extern.slf4j.Slf4j;
import org.springframework.core.io.FileSystemResource;

import java.io.*;

/**
 * <h1></h1>
 *
 * @author : dzj
 * @create: 2021-10-23 21:08
 */
@Slf4j
public class ResourceDemo  {
	public static void main(String[] args) throws IOException {
		FileSystemResource fileSystemResource = new FileSystemResource("F:\\ideaProjectSource\\spring-framework-5.1.x\\spring-demo\\src\\main\\java\\com\\imooc\\demo\\resources\\test.txt");
		File file = fileSystemResource.getFile();
		log.info("length: {}",file.length());
		OutputStream outputStream = fileSystemResource.getOutputStream();
		BufferedWriter bufferedWriter = new BufferedWriter(new OutputStreamWriter(outputStream));
		bufferedWriter.write("ccccc\n");
		bufferedWriter.flush();
		outputStream.close();
		bufferedWriter.close();

	}
}
